#pragma once

#include "XString.h"


namespace platform {


class ProcessInfo
{
public:
	ProcessInfo(void) {}
	virtual ~ProcessInfo(void) {}

	static void GetCurrentProcessExeName(XString &name);

	static DWORD GetThreadIdFromHandle(HANDLE h);

private:
	class NtDllLoader {
		static HMODULE hm;
		static FARPROC fGetThreadInfo;

	public:
		inline NtDllLoader(void) {
			if (hm == NULL) {
				hm = ::LoadLibrary(_T("ntdll.dll"));
				if (hm != NULL) {
					fGetThreadInfo = ::GetProcAddress(hm, "NtQueryInformationThread");
				}
			}
		}

		inline FARPROC getFuncThreadInfo(void) { return fGetThreadInfo; }
	};
};


} // end namespace